/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package deti.es.ukni.persistence.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author eurico
 */
@Entity
@Table(name = "COMMENT")
@NamedQueries({@NamedQuery(name = "Comment.findAll", query = "SELECT c FROM Comment c"), @NamedQuery(name = "Comment.findByIdcomment", query = "SELECT c FROM Comment c WHERE c.idcomment = :idcomment"), @NamedQuery(name = "Comment.findByPostdate", query = "SELECT c FROM Comment c WHERE c.postdate = :postdate"), @NamedQuery(name = "Comment.findByContent", query = "SELECT c FROM Comment c WHERE c.content = :content")})
public class Comment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IDCOMMENT")
    private Integer idcomment;
    @Basic(optional = false)
    @Column(name = "POSTDATE")
    @Temporal(TemporalType.DATE)
    private Date postdate;
    @Basic(optional = false)
    @Column(name = "CONTENT")
    private String content;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "comment", fetch = FetchType.EAGER)
    private Set<CommentVideo> commentVideoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "comment", fetch = FetchType.EAGER)
    private Set<CommentBand> commentBandCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "comment", fetch = FetchType.EAGER)
    private Set<CommentImage> commentImageCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "comment", fetch = FetchType.EAGER)
    private Set<CommentAudio> commentAudioCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "comment", fetch = FetchType.EAGER)
    private Set<CommentEvent> commentEventCollection;

    public Comment() {
    }

    public Comment(Integer idcomment) {
        this.idcomment = idcomment;
    }

    public Comment(Integer idcomment, Date postdate, String content) {
        this.idcomment = idcomment;
        this.postdate = postdate;
        this.content = content;
    }

    public Integer getIdcomment() {
        return idcomment;
    }

    public void setIdcomment(Integer idcomment) {
        this.idcomment = idcomment;
    }

    public Date getPostdate() {
        return postdate;
    }

    public void setPostdate(Date postdate) {
        this.postdate = postdate;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Set<CommentVideo> getCommentVideoCollection() {
        return commentVideoCollection;
    }

    public void setCommentVideoCollection(Set<CommentVideo> commentVideoCollection) {
        this.commentVideoCollection = commentVideoCollection;
    }

    public Set<CommentBand> getCommentBandCollection() {
        return commentBandCollection;
    }

    public void setCommentBandCollection(Set<CommentBand> commentBandCollection) {
        this.commentBandCollection = commentBandCollection;
    }

    public Set<CommentImage> getCommentImageCollection() {
        return commentImageCollection;
    }

    public void setCommentImageCollection(Set<CommentImage> commentImageCollection) {
        this.commentImageCollection = commentImageCollection;
    }

    public Set<CommentAudio> getCommentAudioCollection() {
        return commentAudioCollection;
    }

    public void setCommentAudioCollection(Set<CommentAudio> commentAudioCollection) {
        this.commentAudioCollection = commentAudioCollection;
    }

    public Set<CommentEvent> getCommentEventCollection() {
        return commentEventCollection;
    }

    public void setCommentEventCollection(Set<CommentEvent> commentEventCollection) {
        this.commentEventCollection = commentEventCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcomment != null ? idcomment.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Comment)) {
            return false;
        }
        Comment other = (Comment) object;
        if ((this.idcomment == null && other.idcomment != null) || (this.idcomment != null && !this.idcomment.equals(other.idcomment))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "deti.es.ukni.persistence.entity.Comment[idcomment=" + idcomment + "]";
    }

}
